Image compression technologies include variable-length compression in which the bit length after compression is variable and fixed-length compression in which the bit length after compression is fixed.
In general, in an image compression method in which quantization is performed using the difference relative to a neighboring pixel, it is known that compression is easy at a flat portion where data is redundant and compression is not easy at an edge portion where data is not redundant. For this reason, a balance between the image quality and the compression ratio is achieved by performing control so as to realize high compression at a flat portion and low compression at an edge portion. Because the compression ratio in this method is controlled on a process by process basis of compression, this method belongs to variable-length compression, in which the bit length after compression is variable depending on the region to be processed. In a case where a general natural image is compressed and the unit of compression processing is small, there is a high correlation between neighboring pixels, and hence this method can realize high compression. While capable of high compression in this manner, the variable-length compression is problematic in that it is difficult to randomly access compression data recorded in a memory etc.
In contrast, fixed-length compression is characterized by a low compression ratio but easy random access because compression is performed so that the bit length is equal, whether at a flat portion or at an edge portion. Patent Literature 1 discloses one of such fixed-length compression technologies.
Patent Literature 1 describes that a block having a prescribed number of items of pixel data is set as a unit of processing, thus generating compression image data composed of: the maximum value and the minimum value of the pixel data in that block; position information for the maximum value and the minimum value in that block; and quantized data resulting from quantizing the subtraction values obtained by subtracting the minimum value from the pixel data, excluding the maximum value and the minimum value, in that block.
In Patent Literature 1, at the time of quantization, the above-described subtraction values are quantized on the basis of the number of bit shifts that causes the bit length of the difference between the maximum value and the minimum value to become equal to the bit length after quantization. Furthermore, as a result of control being performed so that the bit lengths of blocks after quantization are equal to one another, the pixel data is compressed so that coded data including the header information has the same bit length in all blocks.